﻿using TealightV5.Models.Bases;
using TealightV5.Models.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TealightV5.Models
{ 
    public partial class Article : Model, IModel, System.IEquatable<Article>, IComparable<Article>
    {
        public int CompareTo(Article other)
        {
            return Id.CompareTo(other.Id);
        }
        public bool Equals(Article other)
        {
            return Id == other.Id;
        }

        public int Id
        {
            get
            {
                return this._Id;
            }
            set
            {
                if (Id != value)
                {
                    this.OnIdChanging(value);
                    this._Id = value;
                    this.OnIdChanged();
                    this.OnPropertyChanged("Id");
                }
            }
        }

        private int _Id;
        partial void OnIdChanging(int value);
        partial void OnIdChanged();


        public string Title
        {
            get
            {
                return this._Title;
            }
            set
            {
                if (Title != value)
                {
                    this.OnTitleChanging(value);
                    this._Title = value;
                    this.OnTitleChanged();
                    this.OnPropertyChanged("Title");
                }
            }
        }

        private string _Title;
        partial void OnTitleChanging(string value);
        partial void OnTitleChanged();


        /// <summary>
        /// Gets or sets the CreatedBy.
        /// </summary>
        /// <value>
        /// The CreatedById.
        /// </value>
        public UserInformationList CreatedBy 
		{ 
			get 
			{ 
				return _CreatedBy;
			} 
			set 
			{ 
                if (CreatedBy != value)
                {
                    this.OnCreatedByChanging(value);
                    this._CreatedBy = value;
                    this.OnCreatedByChanged();
                    this.OnPropertyChanged("CreatedBy");
				    if (value != null)
				    {
					    _CreatedById = value.Id;
				    }
                }
			} 
		}
		private UserInformationList _CreatedBy = new UserInformationList();
        partial void OnCreatedByChanging(UserInformationList value);
        partial void OnCreatedByChanged();

        public int? CreatedById
        {
            get
            {
                return this._CreatedById;
            }
            set
            {
                if (CreatedById != value)
                {
                    this.OnCreatedByIdChanging(value);
                    this._CreatedById = value;
                    this.OnCreatedByIdChanged();
                    this.OnPropertyChanged("CreatedById");
                }
            }
        }

        private int? _CreatedById;
        partial void OnCreatedByIdChanging(int? value);
        partial void OnCreatedByIdChanged();



        /// <summary>
        /// Gets or sets the ModifiedBy.
        /// </summary>
        /// <value>
        /// The ModifiedById.
        /// </value>
        public UserInformationList ModifiedBy 
		{ 
			get 
			{ 
				return _ModifiedBy;
			} 
			set 
			{ 
                if (ModifiedBy != value)
                {
                    this.OnModifiedByChanging(value);
                    this._ModifiedBy = value;
                    this.OnModifiedByChanged();
                    this.OnPropertyChanged("ModifiedBy");
				    if (value != null)
				    {
					    _ModifiedById = value.Id;
				    }
                }
			} 
		}
		private UserInformationList _ModifiedBy = new UserInformationList();
        partial void OnModifiedByChanging(UserInformationList value);
        partial void OnModifiedByChanged();

        public int? ModifiedById
        {
            get
            {
                return this._ModifiedById;
            }
            set
            {
                if (ModifiedById != value)
                {
                    this.OnModifiedByIdChanging(value);
                    this._ModifiedById = value;
                    this.OnModifiedByIdChanged();
                    this.OnPropertyChanged("ModifiedById");
                }
            }
        }

        private int? _ModifiedById;
        partial void OnModifiedByIdChanging(int? value);
        partial void OnModifiedByIdChanged();



        public string Name
        {
            get
            {
                return this._Name;
            }
            set
            {
                if (Name != value)
                {
                    this.OnNameChanging(value);
                    this._Name = value;
                    this.OnNameChanged();
                    this.OnPropertyChanged("Name");
                }
            }
        }

        private string _Name;
        partial void OnNameChanging(string value);
        partial void OnNameChanged();


        public bool? Important
        {
            get
            {
                return this._Important;
            }
            set
            {
                if (Important != value)
                {
                    this.OnImportantChanging(value);
                    this._Important = value;
                    this.OnImportantChanged();
                    this.OnPropertyChanged("Important");
                }
            }
        }

        private bool? _Important;
        partial void OnImportantChanging(bool? value);
        partial void OnImportantChanged();


        public DateTime? PublishedAt
        {
            get
            {
                return this._PublishedAt;
            }
            set
            {
                if (PublishedAt != value)
                {
                    this.OnPublishedAtChanging(value);
                    this._PublishedAt = value;
                    this.OnPublishedAtChanged();
                    this.OnPropertyChanged("PublishedAt");
                }
            }
        }

        private DateTime? _PublishedAt;
        partial void OnPublishedAtChanging(DateTime? value);
        partial void OnPublishedAtChanged();


        public int? Likes
        {
            get
            {
                return this._Likes;
            }
            set
            {
                if (Likes != value)
                {
                    this.OnLikesChanging(value);
                    this._Likes = value;
                    this.OnLikesChanged();
                    this.OnPropertyChanged("Likes");
                }
            }
        }

        private int? _Likes;
        partial void OnLikesChanging(int? value);
        partial void OnLikesChanged();


        public double? Cost
        {
            get
            {
                return this._Cost;
            }
            set
            {
                if (Cost != value)
                {
                    this.OnCostChanging(value);
                    this._Cost = value;
                    this.OnCostChanged();
                    this.OnPropertyChanged("Cost");
                }
            }
        }

        private double? _Cost;
        partial void OnCostChanging(double? value);
        partial void OnCostChanged();


        public decimal? Worth
        {
            get
            {
                return this._Worth;
            }
            set
            {
                if (Worth != value)
                {
                    this.OnWorthChanging(value);
                    this._Worth = value;
                    this.OnWorthChanged();
                    this.OnPropertyChanged("Worth");
                }
            }
        }

        private decimal? _Worth;
        partial void OnWorthChanging(decimal? value);
        partial void OnWorthChanged();


        public TealightV5.Models.Enumerators.ArticleType ArticleType
        {
            get
            {
                return this._ArticleType;
            }
            set
            {
                if (ArticleType != value)
                {
                    this.OnArticleTypeChanging(value);
                    this._ArticleType = value;
                    this.OnArticleTypeChanged();
                    this.OnPropertyChanged("ArticleType");
                }
            }
        }

        private TealightV5.Models.Enumerators.ArticleType _ArticleType;
        partial void OnArticleTypeChanging(TealightV5.Models.Enumerators.ArticleType value);
        partial void OnArticleTypeChanged();

    }
}
